<%@ page import="com.wd.service.BlogService" %>
<%@ page import="com.wd.service.impl.BlogServiceImpl" %>
<%@ page import="com.wd.service.PhotoService" %>
<%@ page import="com.wd.service.impl.PhotoServiceImpl" %>
<%@ page import="com.wd.service.RightService" %>
<%@ page import="com.wd.service.impl.RightServiceImpl" %>


<%@ page import="com.wd.entity.Blog" %>
<%@ page import="java.util.List" %>
<%@ page import="com.wd.util.MarkDownUtil" %>
<%@ page import="com.wd.servlet.BlogShowServlet" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<base href="<%=basePath%>}">
<%
    BlogService blogService=new BlogServiceImpl();
    PhotoService photoService=new PhotoServiceImpl();
    RightService rightService=new RightServiceImpl();

    request.setAttribute("right",rightService.selRight());
    request.setAttribute("ShowArchives",selAllBlogToHtml(blogService.selAllBlog()));
    request.setAttribute("HeaderPhoto",photoService.selPhoto(1));
    request.setAttribute("showArchivesCount",blogService.selAllBlogCount());
%>
<%!
    public static List<Blog> selAllBlogToHtml(List<Blog> list){
        for(Blog blog:list){
            blog.setContent(MarkDownUtil.mdToHtml(blog.getContent()));
        }
        return list;
    }
%>
<base href="<%=basePath%>}">
<html lang="zh-CN" data-theme="light">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>首页 | 凪のblog</title>
    <meta property="og:image" content="https://github.com/cqvcq/img/blob/main/post.jpg">
    <link rel="stylesheet" href="../blog/css/index.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome@latest/css/font-awesome.min.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css">
    <link rel="canonical" href="https://github.com/cqvcq/img/blob/main/">
    <meta name="generator" content="Hexo 4.2.0">
</head>
<body>
<div id="body-wrap">
    <jsp:include page="./header.jsp" />

    <main class="layout_page" id="content-inner">
        <div class="recent-posts" id="recent-posts">
            <c:forEach items="${requestScope.blogs}" var="blog">
                <div class="recent-post-item">
                    <div class="post_cover left_radius">
                        <a href="BlogShowServlet?blogID=${blog.id}" title="${blog.title}">
                            <img class="post_bg lazyload" data-src="${blog.photo}"
                                 onerror="this.onerror=null;this.src='/img/404.jpg'" alt="${blog.title}">
                        </a>
                    </div>
                    <div class="recent-post-info">
                        <a class="article-title" href="BlogShowServlet?blogID=${blog.id}"
                           title="${blog.title}">${blog.title}</a>
                        <div class="article-meta-wrap">
                            <time class="post-meta__date" title="发表于 ${blog.uploadTime}"><i class="fa fa-calendar"
                                                                                            aria-hidden="true"></i>${blog.uploadTime}
                            </time>
                            <span class="article-meta"><span class="article-meta__separator">|</span>
                            <i class="fa fa-inbox article-meta__icon" aria-hidden="true"></i>
                            <a class="article-meta__categories" href="/categories/mysql/">${blog.catalog}</a>
                                <span class="article-meta"><span class="article-meta__separator">|    </span>
                                    作者：${blog.author}
                        </span>
                        </div>
                        <div class="content">${blog.content}</div>
                    </div>

                </div>
            </c:forEach>
            <hr>

            <div id="post-comment">
                <div class="comment_headling"><i class="fa fa-comments fa-fw" aria-hidden="true"></i><span> 评论</span></div>
                <div class="vcomment" id="vcomment"></div>

                <script src="https://cdn.jsdelivr.net/npm/valine/dist/Valine.min.js"></script>
                <script>var GUEST_INFO = ['nick','mail','link'];
                var guest_info = 'nick,mail,link'.split(',').filter(function(item){
                    return GUEST_INFO.indexOf(item) > -1
                });
                guest_info = guest_info.length == 0 ? GUEST_INFO :guest_info;
                window.valine = new Valine({
                    el:'#vcomment',
                    notify: false,
                    verify: false,
                    appId: '${requestScope.ShowComment.appId}',
                    appKey: '${requestScope.ShowComment.appKey}',
                    placeholder: '${requestScope.ShowComment.placeholder}',
                    avatar: 'monsterid',
                    meta: guest_info,
                    pageSize: '10',
                    lang: 'zh-cn',
                    recordIP: false,
                    serverURLs: ''
                });
                </script>
            </div>
        </div>
        <jsp:include page="right.jsp"/>
    </main>
    <jsp:include page="foot.jsp"/>
</div>
<!-- jQuery -->
<script src="../admin/plugins/jquery/jquery.min.js"></script>
<!-- jQuery UI 1.11.4 -->
<script src="../admin/plugins/jQueryUI/jquery-ui.min.js"></script>
<!-- Bootstrap 4 -->
<script src="../admin/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- AdminLTE App -->
<script src="../admin/dist/js/adminlte.min.js"></script>
<!-- sweetalert -->
<script src="../admin/plugins/sweetalert/sweetalert.min.js"></script>
<%--<script src="admin/dist/js/configuration.js"></script>--%>
<script src="https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js"></script>
<script src="../blog/js/utils.js"></script>
<!-- <script src="js/main.js"></script> -->
<!-- <script src="js/tw_cn.js"></script> -->
<script src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js"></script>
<script defer id="ribbon" src="../blog/js/third-party/canvas-ribbon.js" size="150" alpha="0.6" zIndex="-1" mobile="true"
        data-click="false"></script>
<script id="canvas_nest" color="0,0,255" opacity="0.7" zIndex="-1" count="99" mobile="true" src="../blog/js/third-party/canvas-nest.js"></script>
<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>

<script src="https://cdn.jsdelivr.net/npm/instant.page@latest/instantpage.min.js" type="module"></script>
<script src="https://cdn.jsdelivr.net/npm/lazysizes@latest/lazysizes.min.js" async=""></script>
<script id="ribbon_piao" mobile="true" src="https://cdn.jsdelivr.net/gh/jerryc127/butterfly_cdn@2.1.0/js/piao.js"></script>
<script src="../blog/js/refuseF12.js"></script>
<%--<script src="blog/js/jquery-3.4.1.js"></script>--%>
<script src="../blog/js/third-party/click_heart.js"></script>
<script>
    $(function () {
        $("#veditor").css("backgroundImage","url("+"${requestScope.ShowComment.placePhoto}"+")");
        if("${requestScope.ShowComment.flag}"!="true"){
            $("#post-comment").css("display","none");
        }
        $("#site_title").html("收藏夹");
        //顶部背景图片
        $(".not-index-bg").css("background-image","url("+"${requestScope.HeaderPhoto.tagPhoto}"+")");

    })

    function info() {
        $("#infoModal").modal('show');
        $("#infoModal input").val("");
    }

</script>

</body>
</html>
